#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//https://www.luogu.com.cn/problem/P2249
using namespace std;
const int N = 1e6 + 10;
int n, m;
int a[N];


int find(int x)
{
	int l = 1, r = n;
	while (l < r)
	{
		int mid = (l + r) / 2;
		if (a[mid] >= x) r = mid;
		else l = mid + 1;
	}
	//cout << a[l] << endl;
	if (a[l] == x)return l;
	return -1;
}

int main()
{
	cin >> n >> m;

	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", &a[i]);
	}
	while (m--)
	{
		int x;
		cin >> x;
		cout << find(x) << ' ';
	}

	return 0;
}